package cal;

public class Calculater {
    private double firstnum;
    private double secondnum;
    private String oper;
    public double getFirstnum() {
        return firstnum;
    }
    public void setFirstnum(double firstnum) {
        this.firstnum = firstnum;
    }
    public double getSecondnum() {
        return secondnum;
    }
    public void setSecondnum(double secondnum) {
        this.secondnum = secondnum;
    }
    public String getOper() {
        return oper;
    }
    public void setOper(String oper) {
        this.oper = oper;
    }
    public double getResult(){

        try {
            if(oper.equals("+")){
                return firstnum+secondnum;
            }else if(oper.equals("-")){
                return firstnum-secondnum;
            }if(oper.equals("*")){
                return firstnum*secondnum;
            }else{
                return firstnum/secondnum;
            }
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return 0;
    }


}

